#include <algorithm>
#include <iostream>
#include <vector>

/**
 * PAT A 1085 Perfect Sequence
 */

std::vector<int> seq;

int main() {
    // Read sequence
    int num, p;
    scanf("%d %d", &num, &p);
    seq.reserve(num);
    for (int i = 0; i < num; i++) {
        int val;
        scanf("%d", &val);
        seq.push_back(val);
    }

    // Sort the sequence
    std::sort(seq.begin(), seq.end());

    // Find longest subsequence
    int maxLen = 0;
    for (int i = 0; i < num; i++) {
        int val = seq[i];
        int maxM = val * p;
        if (maxM < 0) // M overflows
            maxM = INT32_MAX;
        std::vector<int>::iterator pos =
            std::upper_bound(seq.begin(), seq.end(), maxM);
        int len = &*pos - &seq[i];
        maxLen = std::max(len, maxLen);
        if (pos == seq.end())
            break;
    }
    printf("%d\n", maxLen);

    return 0;
}